.class public Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/GeodeticCalculator;
.super Ljava/lang/Object;
.source "GeodeticCalculator.java"


# instance fields
.field private final TwoPi:D


# direct methods
.method public constructor <init>()V
    .locals 2

    .line 20
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    const-wide v0, 0x401921fb54442d18L    # 6.283185307179586

    .line 22
    iput-wide v0, p0, Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/GeodeticCalculator;->TwoPi:D

    return-void
.end method


# virtual methods
.method public calculateEndingGlobalCoordinates(Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/Ellipsoid;Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/GlobalCoordinates;DD)Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/GlobalCoordinates;
    .locals 8

    const/4 v7, 0x0

    move-object v0, p0

    move-object v1, p1

    move-object v2, p2

    move-wide v3, p3

    move-wide v5, p5

    .line 159
    invoke-virtual/range {v0 .. v7}, Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/GeodeticCalculator;->calculateEndingGlobalCoordinates(Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/Ellipsoid;Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/GlobalCoordinates;DD[D)Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/GlobalCoordinates;

    move-result-object p1

    return-object p1
.end method

.method public calculateEndingGlobalCoordinates(Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/Ellipsoid;Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/GlobalCoordinates;DD[D)Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/GlobalCoordinates;
    .locals 51

    move-object/from16 v0, p7

    .line 40
    invoke-virtual/range {p1 .. p1}, Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/Ellipsoid;->getSemiMajorAxis()D

    move-result-wide v1

    .line 41
    invoke-virtual/range {p1 .. p1}, Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/Ellipsoid;->getSemiMinorAxis()D

    move-result-wide v3

    mul-double v1, v1, v1

    mul-double v5, v3, v3

    .line 44
    invoke-virtual/range {p1 .. p1}, Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/Ellipsoid;->getFlattening()D

    move-result-wide v7

    .line 45
    invoke-virtual/range {p2 .. p2}, Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/GlobalCoordinates;->getLatitude()D

    move-result-wide v9

    invoke-static {v9, v10}, Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/Angle;->toRadians(D)D

    move-result-wide v9

    .line 46
    invoke-static/range {p3 .. p4}, Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/Angle;->toRadians(D)D

    move-result-wide v11

    .line 47
    invoke-static {v11, v12}, Ljava/lang/Math;->cos(D)D

    move-result-wide v13

    .line 48
    invoke-static {v11, v12}, Ljava/lang/Math;->sin(D)D

    move-result-wide v11

    const-wide/high16 v15, 0x3ff0000000000000L    # 1.0

    sub-double v17, v15, v7

    .line 50
    invoke-static {v9, v10}, Ljava/lang/Math;->tan(D)D

    move-result-wide v9

    mul-double v9, v9, v17

    mul-double v19, v9, v9

    add-double v19, v19, v15

    .line 51
    invoke-static/range {v19 .. v20}, Ljava/lang/Math;->sqrt(D)D

    move-result-wide v19

    div-double v19, v15, v19

    move-wide/from16 v21, v7

    mul-double v7, v9, v19

    .line 55
    invoke-static {v9, v10, v13, v14}, Ljava/lang/Math;->atan2(DD)D

    move-result-wide v9

    move-wide/from16 p3, v13

    mul-double v13, v19, v11

    mul-double v23, v13, v13

    sub-double v25, v15, v23

    sub-double/2addr v1, v5

    mul-double v1, v1, v25

    div-double/2addr v1, v5

    const-wide/high16 v5, 0x40d0000000000000L    # 16384.0

    div-double v5, v1, v5

    const-wide v27, 0x4065e00000000000L    # 175.0

    mul-double v27, v27, v1

    const-wide/high16 v29, 0x4074000000000000L    # 320.0

    sub-double v29, v29, v27

    mul-double v29, v29, v1

    const-wide/high16 v27, -0x3f78000000000000L    # -768.0

    add-double v29, v29, v27

    mul-double v29, v29, v1

    const-wide/high16 v27, 0x40b0000000000000L    # 4096.0

    add-double v29, v29, v27

    mul-double v5, v5, v29

    add-double/2addr v5, v15

    const-wide/high16 v27, 0x4090000000000000L    # 1024.0

    div-double v27, v1, v27

    const-wide v29, 0x4047800000000000L    # 47.0

    mul-double v29, v29, v1

    const-wide v31, 0x4052800000000000L    # 74.0

    sub-double v31, v31, v29

    mul-double v31, v31, v1

    const-wide/high16 v29, -0x3fa0000000000000L    # -128.0

    add-double v31, v31, v29

    mul-double v1, v1, v31

    const-wide/high16 v29, 0x4070000000000000L    # 256.0

    add-double v1, v1, v29

    mul-double v27, v27, v1

    mul-double v3, v3, v5

    div-double v1, p5, v3

    move-wide v3, v1

    :goto_0
    const-wide/high16 v5, 0x4000000000000000L    # 2.0

    mul-double v29, v9, v5

    add-double v31, v29, v3

    .line 84
    invoke-static/range {v31 .. v32}, Ljava/lang/Math;->cos(D)D

    move-result-wide v31

    mul-double v33, v31, v31

    .line 86
    invoke-static {v3, v4}, Ljava/lang/Math;->sin(D)D

    move-result-wide v35

    .line 87
    invoke-static {v3, v4}, Ljava/lang/Math;->cos(D)D

    move-result-wide v37

    mul-double v39, v27, v35

    const-wide/high16 v41, 0x4010000000000000L    # 4.0

    div-double v43, v27, v41

    mul-double v45, v33, v5

    const-wide/high16 v47, -0x4010000000000000L    # -1.0

    add-double v45, v45, v47

    mul-double v37, v37, v45

    const-wide/high16 v45, 0x4018000000000000L    # 6.0

    div-double v45, v27, v45

    mul-double v45, v45, v31

    mul-double v49, v35, v41

    mul-double v49, v49, v35

    const-wide/high16 v35, -0x3ff8000000000000L    # -3.0

    add-double v49, v49, v35

    mul-double v45, v45, v49

    mul-double v33, v33, v41

    add-double v33, v33, v35

    mul-double v45, v45, v33

    sub-double v37, v37, v45

    mul-double v43, v43, v37

    add-double v31, v31, v43

    mul-double v39, v39, v31

    add-double v31, v1, v39

    sub-double v3, v31, v3

    .line 99
    invoke-static {v3, v4}, Ljava/lang/Math;->abs(D)D

    move-result-wide v3

    const-wide v33, 0x3d3c25c268497682L    # 1.0E-13

    cmpg-double v35, v3, v33

    if-gez v35, :cond_1

    add-double v29, v29, v31

    .line 105
    invoke-static/range {v29 .. v30}, Ljava/lang/Math;->cos(D)D

    move-result-wide v1

    mul-double v3, v1, v1

    .line 108
    invoke-static/range {v31 .. v32}, Ljava/lang/Math;->cos(D)D

    move-result-wide v9

    .line 109
    invoke-static/range {v31 .. v32}, Ljava/lang/Math;->sin(D)D

    move-result-wide v27

    mul-double v29, v7, v9

    mul-double v33, v19, v27

    mul-double v33, v33, p3

    add-double v5, v29, v33

    mul-double v29, v7, v27

    mul-double v19, v19, v9

    mul-double v33, v19, p3

    move-wide/from16 v35, v7

    sub-double v7, v29, v33

    move-wide/from16 v37, v1

    const-wide/high16 v0, 0x4000000000000000L    # 2.0

    .line 113
    invoke-static {v7, v8, v0, v1}, Ljava/lang/Math;->pow(DD)D

    move-result-wide v7

    add-double v23, v23, v7

    invoke-static/range {v23 .. v24}, Ljava/lang/Math;->sqrt(D)D

    move-result-wide v0

    mul-double v0, v0, v17

    .line 112
    invoke-static {v5, v6, v0, v1}, Ljava/lang/Math;->atan2(DD)D

    move-result-wide v0

    mul-double v11, v11, v27

    mul-double v29, v29, p3

    sub-double v5, v19, v29

    .line 123
    invoke-static {v11, v12, v5, v6}, Ljava/lang/Math;->atan2(DD)D

    move-result-wide v5

    const-wide/high16 v7, 0x4030000000000000L    # 16.0

    div-double v7, v21, v7

    mul-double v7, v7, v25

    const-wide/high16 v11, 0x4008000000000000L    # 3.0

    mul-double v25, v25, v11

    sub-double v11, v41, v25

    mul-double v11, v11, v21

    add-double v11, v11, v41

    mul-double v7, v7, v11

    sub-double/2addr v15, v7

    mul-double v15, v15, v21

    mul-double v15, v15, v13

    mul-double v11, v7, v27

    mul-double v7, v7, v9

    const-wide/high16 v9, 0x4000000000000000L    # 2.0

    mul-double v3, v3, v9

    add-double v3, v3, v47

    mul-double v7, v7, v3

    add-double v2, v37, v7

    mul-double v11, v11, v2

    add-double v31, v31, v11

    mul-double v15, v15, v31

    sub-double/2addr v5, v15

    move-wide/from16 v3, v35

    neg-double v2, v3

    mul-double v2, v2, v27

    add-double v2, v2, v33

    .line 132
    invoke-static {v13, v14, v2, v3}, Ljava/lang/Math;->atan2(DD)D

    move-result-wide v2

    .line 135
    invoke-static {v0, v1}, Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/Angle;->toDegrees(D)D

    move-result-wide v0

    .line 136
    invoke-virtual/range {p2 .. p2}, Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/GlobalCoordinates;->getLongitude()D

    move-result-wide v7

    invoke-static {v5, v6}, Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/Angle;->toDegrees(D)D

    move-result-wide v4

    add-double/2addr v7, v4

    move-object/from16 v5, p7

    if-eqz v5, :cond_0

    .line 138
    array-length v4, v5

    if-lez v4, :cond_0

    const/4 v4, 0x0

    .line 140
    invoke-static {v2, v3}, Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/Angle;->toDegrees(D)D

    move-result-wide v2

    aput-wide v2, v5, v4

    .line 143
    :cond_0
    new-instance v2, Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/GlobalCoordinates;

    invoke-direct {v2, v0, v1, v7, v8}, Llt/noframe/gpsfarmguide/utils/geoCalcs/mike_gavaghan/GlobalCoordinates;-><init>(DD)V

    return-object v2

    :cond_1
    move-wide/from16 v3, v31

    goto/16 :goto_0
.end method
